package com.bawei.module_list.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.bawei.module_base.net.bean.list.FindLeaderBoardBean
import com.bawei.module_base.net.util.HttpUtils2
import com.bawei.module_base.ui.base.BaseResult
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

class ListViewModel: ViewModel() {
    val dataFindLeaderBoard=MutableLiveData<BaseResult<FindLeaderBoardBean>>()
    //tab下标切换状态监听
    val tabPositionIndex=MutableLiveData<Int>()
    fun tabPosition(id:Int){
        tabPositionIndex.value=id
    }
    fun getFindLeaderBoard(){
        viewModelScope.launch(Dispatchers.IO){
            var result= HttpUtils2.apiService.getFindLeaderBoard()
            dataFindLeaderBoard.postValue(result)
        }
    }
}